﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using Willson.JsbManager.Bll;
using Willson.JsbManager.Comm;
using Willson.JsbManager.BllEntity;

namespace Willson.JsbManager.UI
{
    public partial class DefaultForm : WeifenLuo.WinFormsUI.Docking.DockContent
    {
        private MainForm main = null;
        
        public DefaultForm(MainForm main)
        {
            this.main = main;
            InitializeComponent();
        }

        public void InitMenuList()
        {
            this.flowLayoutPanel_main.Controls.Clear();

            IEnumerator<BEChildMenuInfo> ator = BLLFactory<BLLMenuInfo>.Instance.GetQuickMenuList((Program.context.MainForm as MainForm).User_id).GetEnumerator();

            int index = 0;

            while (ator.MoveNext())
            {
                UCListViewItem item = new UCListViewItem(main);
                WinInfo tmp = new WinInfo();
                item.ItemCaption = ator.Current.MenuName;
                item.ItemImage = this.imageList.Images[index++];
                item.ItemMemo = ator.Current.MenuMemo;

                tmp.Form_name = ator.Current.MenuWindow;
                tmp.Menu_isshow = ator.Current.MenuIsshow;
                tmp.User_id = (Program.context.MainForm as MainForm).User_id;
                tmp.Menu_id = ator.Current.Id;

                item.Tag = tmp;

                this.flowLayoutPanel_main.Controls.Add(item);

            }

        }

        private void DefaultForm_Load(object sender, EventArgs e)
        {
            InitMenuList();
        }
    }
}
